package bpm.dao.impl;

import javax.annotation.Resource;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import bpm.dao.PropertyQuerier;

@Repository("propertyQuerier")
@Transactional
public class PropertyQuerierImpl implements PropertyQuerier {
	@Resource
	private JdbcTemplate jdbcTemplate;
	
	@Transactional(propagation=Propagation.NOT_SUPPORTED)
	public String queryForString(String sql, Object... args) {
		String result = null;
		if(args.length == 0) {
			result = (String)this.jdbcTemplate.queryForObject(sql, String.class);
		} else {
			result = (String)this.jdbcTemplate.queryForObject(sql, args, String.class);
		}
		return result;
	}
	public void updateProperty(String sql, Object... args) {
		this.jdbcTemplate.update(sql, args);
	}

}
